package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service;

import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Conference;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.ParticipatingConference;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.mapper.ParticipatingConferenceMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author 张烁瑜
 * @Date 2025/5/20 20:26
 */
@Service
public class ParticipatingConferenceService {

    @Autowired
    private ParticipatingConferenceMapper participatingConferenceMapper;

    public String save(ParticipatingConference participatingConference) {
        if (participatingConferenceMapper.save(participatingConference)) {
            return "保存成功";
        }
        return "保存失败";
    }

    public String delete(Long participatingConferenceId) {
        if (participatingConferenceMapper.delete(participatingConferenceId)) {
            return "删除成功";
        }
        return "删除失败";
    }

    public String update(ParticipatingConference participatingConference) {
        if (participatingConferenceMapper.update(participatingConference)) {
            return "更新成功";
        }
        return "更新失败";
    }

    public PageInfo<ParticipatingConference> get(int pageNum, int pageSize, ParticipatingConference participatingConference){
        PageHelper.startPage(pageNum,pageSize);
        List<ParticipatingConference> participatingConferenceList  = participatingConferenceMapper.get(participatingConference);
        return PageInfo.of(participatingConferenceList);
    }


}
